<template>

</template>

<script setup>
import { useRoute } from "vue-router"
import axiosInstance from "@/axios/index.js"
import { onMounted } from "vue"
import router from "@/router"
import { ElMessage } from 'element-plus'

const code = useRoute().query.code
const state = useRoute().query.state
const studentId = useRoute().params.studentId
//发起微信登录
let bindWeChat = function (studentId, code, state) {
  axiosInstance.get('/student/bindingWeChat', {
    params: {
      studentId,
      code,
      state,
    }
  }).then(response => {
    ElMessage({
      type: 'success',
      message: response.data.message
    })
    router.push("/personal/info")
  }).catch(error => {
    router.push("/personal/info")
  })
}
onMounted(() => {
  bindWeChat(studentId, code, state)
})
</script>

<style scoped></style>